//
//  RBBannerView.h
//  SaltyHeart
//
//  Created by Lan on 2017/6/5.
//  Copyright © 2017年 ST. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "iCarousel.h"

@class RBBannerView;
@protocol RBBannerViewDelegate <NSObject>

/** 图片数量 */
- (NSInteger)numberOfItemsInBannerView: (RBBannerView *)bannerView;

/** UIView已经生成,需要自行配置 */
- (void)bannerView: (RBBannerView *)bannerView willSetupView: (UIView *)view withIndex: (NSInteger)index;

@optional
/** 点击view后自定义操作 */
- (void)bannerView:(RBBannerView *)bannerView didSelectView:(UIView *)view withIndex: (NSInteger)index;

/** 实时改变,index是浮点数 */
- (void)bannerView:(RBBannerView *)bannerView scrollToIndex: (CGFloat)index;

@end

@interface RBBannerView : UIView

/** 必须设置 */
@property(nonatomic, weak) id<RBBannerViewDelegate> deleagte;

@property(nonatomic, strong, readonly) iCarousel *carousel;
/** 默认UIImageView */
@property(nonatomic, assign) Class itemViewClass;
/** 自动滚动时间间隔,<=0,不滚动 */
@property(nonatomic, assign) CGFloat duration;
/** 根据index取视图 */
- (UIView *)viewWithIndex: (NSInteger)index;

/** 刷新数据,需要手动调用一次 */
- (void)reloadData;

@end
